package com.wang.ymcc.web.controller;

import com.wang.lwm.result.JSONResult;
import com.wang.ymcc.service.ITokenService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/*
    下单的时候 生成token防止重复提交

 */
@RestController
@RequestMapping("/courseOrder")
public class TokenController {
    @Autowired
    private ITokenService tokenService;

    @GetMapping("/createTokenForOrder/{ids}")
    public JSONResult createTokenForOrder(@PathVariable("ids")String ids){
        String token=tokenService.createOrderToken(ids);
        return  JSONResult.success(token);
    }
}
